Repository navigation
Ragdolls not cleaning their collision hash fix - #562
Open
MyGamepedia wants to merge 1 commit into
Open
MyGamepedia wants to merge 1 commit into
MyGamepedia wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Usually this is not an issue until the entity is removed from the map. There is prop_ragdoll_attached entity, which is usually created by the npc_barnacle entity, in order for this creature to eat its victim without causing errors, it uses collision hash (g_EntityCollisionHash) to prevent the prop_ragdoll_attached from colliding with the npc_barnacle, the barnacle's npc_barnacle_tongue_tip, and worldspawn. Collision hash recognizes an entity using only entindex, not the serial number (entref). and because the prop_ragdoll_attached is usually removed from the map when eaten by the npc_barnacle, it leaves its old entry in collision hash.
What does all this mean ? If a new networked entity will occupy the same entindex slot the removed prop_ragdoll_attached did, this new entity will also receive the collision hash rules, and fall out of world, because the collision hash tells it do not collide with worldspawn.
I'm not sure if it's just server ragdolls or everything else as well, but for me it became a problem when I started using server ragdolls created by dead NPCs, the chance this bug will happen is kinda low (difficult to repeat intentionally), but because I tested my project a lot, I noticed this bug many times, but for a long time I did not understand what the problem was.
The fix is quite simple, before the entity is removed, clear the collision hash for this and bones (IPhysicsObjects stored in m_ragdoll.list[i].pObject).
I should note that I initially noticed this bug only in Black Mesa, but by looking at the code, it can be replicated in Mapbase and HL2; this mechanic has no difs between these games. That's why I opened this PR, perhaps it will help someone. After implementing the fix, I haven't noticed anything like this happening again (don't ask me here how I can modify this proprietary game as it's a complicated topic).
I have some footage of this bug saved, where two barnacles eat two headcrabs, then I kill a houndeye and one of these barnacles, they create a bunch of bones, then I kill the zombie guard, and it creates his corpse and the corpse of the headcrab, both fall through the floor.
https://github.com/user-attachments/assets/7de40f80-9d4f-4579-ac7a-3154595cbbc7
Does this PR close any issues?
PR Checklist
developbranch OR targets another branch with a specific goal in mind